.text
	.section	.rodata
.LC0:
	.string	"this is little endian"
.LC1:
	.string	"this is big endian"
	.text
	.globl	main
	.type	main, @function
main:
    addi sp, sp, -32
    sd ra, 24(sp)
    sd s0, 16(sp)
    addi s0, sp, 16
    // s1: -2(s0)
    // first_c: -3(s0)
    li a5, 0x1234
    sh a5, -2(s0) /* s1 */
    addi a5, s0, -2
    lb a5, 0(a5)
    sb a5, -3(s0) /* first_c */
    lb a5, -3(s0) /* first_c */
    sext.b a5, a5
    li a6, 0x34
    beq a5, a6, .LITTLE_ENDIAN
    li a6, 0x12
    beq a5, a6, .BIG_ENDIAN
    j .EXIT_SUCCESS
.LITTLE_ENDIAN:
    lui a5, %hi(.LC0)
    addi a0, a5, %lo(.LC0)
    call puts
    j .EXIT_SUCCESS
.BIG_ENDIAN:
    lui a5, %hi(.LC1)
    addi a0, a5, %lo(.LC1)
    call puts
.EXIT_SUCCESS:
    mv a0, zero
    ld ra, 24(sp)
    ld s0, 16(sp)
    addi sp, sp, 32
    jr ra